home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-04-03 | 5.4 KB | 186 lines | [TEXT/MPS ] |
- //----------------------------------------------------------------------------------------
- // UFloatWindow.cp
- // Copyright © 1987-96 by Apple Computer, Inc. All rights reserved.
- //----------------------------------------------------------------------------------------
-
- #ifndef __UFLOATWINDOW__
- #include "UFloatWindow.h"
- #endif
-
- // MacApp
-
- #ifndef __GEOMETRY__
- #include "Geometry.h"
- #endif
-
- // #ifndef __UAPPLICATION__
- // #include "UApplication.h"
- // #endif
-
- #ifndef __UCOREGLOBALS__
- #include "UCoreGlobals.h"
- #endif
-
- #ifndef __UDISPATCHER__
- #include "UDispatcher.h"
- #endif
-
- #ifndef __UMACAPPGLOBALS__
- #include "UMacAppGlobals.h"
- #endif
-
- // #ifndef __UMACAPPUTILITIES__
- // #include "UMacAppUtilities.h"
- // #endif
-
- // Toolbox
-
- #ifndef __TOOLUTILS__
- #include <ToolUtils.h>
- #endif
-
- //----------------------------------------------------------------------------------------
- Boolean gUFloatWindowInitialized; // declared in header
-
- //----------------------------------------------------------------------------------------
-
- //========================================================================================
- // CLASS TFloatWindow
- //========================================================================================
- #undef Inherited
- #define Inherited TWindow
-
- #pragma segment MAOpen
- MA_DEFINE_CLASS_M1(TFloatWindow, Inherited);
-
- //----------------------------------------------------------------------------------------
- // TFloatWindow constructor
- //----------------------------------------------------------------------------------------
- #pragma segment MAOpen
-
- TFloatWindow::TFloatWindow()
- {
- // Override default value for fResizeLimits
- fResizeLimits[topLeft] = CPoint(1, 1);
-
- fHideOnSuspend = TRUE;
- fDoFirstClick = TRUE;
- fFloats = TRUE;
- fGenerateActivates = FALSE;
- fOMClassID = cPalette; // Establish AEOM class ID
- } // TFloatWindow::TFloatWindow
-
- //----------------------------------------------------------------------------------------
- // TFloatWindow destructor
- //----------------------------------------------------------------------------------------
- #pragma segment MADestructorRes
-
- TFloatWindow::~TFloatWindow()
- {
- }
-
- //----------------------------------------------------------------------------------------
- // TFloatWindow::IFloatWindow:
- //----------------------------------------------------------------------------------------
- #pragma segment MAOpen
-
- void TFloatWindow::IFloatWindow(TDocument* itsDocument,
- WindowRef itsWMgrWindow,
- Boolean canResize,
- Boolean canClose,
- Boolean disposeOnFree)
- {
- this->IWindow(itsDocument, itsWMgrWindow, canResize, canClose, disposeOnFree);
- SetWindowKind(itsWMgrWindow,kFloatingWindowKind);// mark it as a floating window
-
- } // TFloatWindow::IFloatWindow
-
- //----------------------------------------------------------------------------------------
- // TFloatWindow::GetStandardSignature:
- //----------------------------------------------------------------------------------------
- #pragma segment MAWriteResource
-
- IDType TFloatWindow::GetStandardSignature()// override
- {
- return kStdFloatWindow;
- } // TFloatWindow::GetStandardSignature
-
- //----------------------------------------------------------------------------------------
- // TFloatWindow::ReadFields:
- //----------------------------------------------------------------------------------------
- #pragma segment MAReadResource
-
- void TFloatWindow::ReadFields(TStream* aStream)// override
- {
- Inherited::ReadFields(aStream);
-
- SetWindowKind(fWMgrWindow, kFloatingWindowKind);// mark it as a floating window
- } // TFloatWindow::ReadFields
-
- //----------------------------------------------------------------------------------------
- // TFloatWindow::GetBehindWindowPtr:
- //----------------------------------------------------------------------------------------
- #pragma segment MAOpen
-
- WindowRef TFloatWindow::GetBehindWindowPtr()
-
- {
- // bring the float window up in front of all other windows
- return (WindowRef) - 1;
- } // TFloatWindow::GetBehindWindowPtr
-
- //----------------------------------------------------------------------------------------
- // TFloatWindow::Close:
- //----------------------------------------------------------------------------------------
- #pragma segment MAClose
-
- void TFloatWindow::Close() // Override
-
- {
- Inherited::Close();
-
- TEventHandler* activeTarget = NULL;
-
- TWindow* activeWindow = gDispatcher->GetActiveWindow(!kFloatersOK);
-
- // Non-floater is always targettable.
- if (activeWindow)
- activeTarget = activeWindow->GetWindowTarget();
-
- if (activeTarget != NULL)
- {
- gDispatcher->SetTarget(activeTarget);
- activeTarget->SetTargetSelection(kRedraw);
- }
- else
- gDispatcher->SetTarget(gDispatcher);
- } // TFloatWindow::Close
-
-
- //========================================================================================
- // GLOBAL Procedures
- //========================================================================================
- #undef Inherited
-
- //----------------------------------------------------------------------------------------
- // InitUFloatWindow:
- //----------------------------------------------------------------------------------------
- #pragma segment MAWindowRes
-
- void InitUFloatWindow()
- {
- if (gUFloatWindowInitialized)
- return;
-
- #if qTemplateViews
- MA_REGISTER_SIGNATURE(TFloatWindow, kStdFloatWindow);
- #endif
-
- gUFloatWindowInitialized = TRUE;
- } // InitUFloatWindow
-
- //----------------------------------------------------------------------------------------
- // End of UFloatWindow.cp
-
- #pragma segment Inline
-